package com.jy.event.domain;

import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;

/**
 * 优惠券
 * Created by hanxi on 2017/11/16.
 */
@Entity
@Data
@NoArgsConstructor
public class Coupon {

    @Id
    @Column(length = 50)
    private String id;
    /**
     * 优惠券名称
     */
    private String title;
    /**
     * 使用说明
     */
    private String notice;
    /**
     * 优惠券详细说明
     */
    private String description;
    /**
     * 优惠券类型
     */
    @Enumerated(EnumType.STRING)
    private CouponType type;
    /**
     * 商品id，当CouponType=GET_ITEM_FREE时不为空
     */
    private String productId;
    /**
     * 商品名称，当CouponType=GET_ITEM_FREE时不为空
     */
    private String productName;
    /**
     * 优惠券来源
     */
    @Enumerated(EnumType.STRING)
    private CouponSource source;
    /**
     * 店铺id，当CouponSource=STORE时不为空
     */
    private String storeId;
    /**
     * 是否可以分享
     */
    private boolean shareable;
    /**
     * 领取后多少天过期
     */
    private short expireDays = 10;
    /**
     * logo URL
     */
    private String logoURL;

    /**
     * 状态是否删除
     */
    private boolean enabled = true;

    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3)")
    private Date addTime;
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)")
    private Date updateTime;


}
